package com.glc.hms.system.model.wrapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glc.hms.common.controller.BaseWrap;
import com.glc.hms.core.common.ConstantFactory;
import com.glc.hms.system.entity.SysRole;

import java.util.List;
import java.util.Map;

/**
 * @author Santa
 * @since 2019/11/27
 */
public class UserWrapper extends BaseWrap {
    public UserWrapper(Map<String, Object> single) {
        super(single);
    }

    public UserWrapper(List<Map<String, Object>> multi) {
        super(multi);
    }

    public UserWrapper(Page<Map<String, Object>> page) {
        super(page);
    }

    @Override
    protected void wrapTheMap(Map<String, Object> map) {
//        if(map.get("deptId")!=null){
//            map.put("deptName",ConstantFactory.me().getDeptNameById(Long.valueOf(map.get("deptId").toString())));
//        }

        SysRole role = ConstantFactory.me().getRoleByUserId((Long) map.get("userId"));
        if(role!=null){
            map.put("roleName",role.getRemark());
            map.put("roleId",role.getRoleId());
        }

    }
}























